import Vue from 'vue'
import Vuex from 'vuex'
import getEmpInfo from '@/interface/getEmpInfo'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
      forcedLogin: false,
      hasLogin: false,
      userName: "",
      empInfo: {
        employeeName: ''
      },  // 员工信息
    },
    mutations: {
      setEmpInfo(state, info){
        console.log('info', info);
        state.empInfo = info;
      },
    },
    actions: {
      async getEmpInfo({ commit }){
        commit('setEmpInfo', await getEmpInfo())
      }
    }
})

export default store
